package com.newenergy.wisehome.data.bean;

import com.j256.ormlite.field.DatabaseField;
import com.j256.ormlite.table.DatabaseTable;

import java.io.Serializable;
import java.util.UUID;

import cn.com.broadlink.sdk.data.controller.BLDNADevice;

/**
 * Created by kyx on 2018/4/25.
 * 风扇实体类
 */
@DatabaseTable(tableName = "tb_bldeviceinfo")
public class BLDeviceInfo implements Serializable {
    private static final long serialVersionUID = -6716919754718380845L;

    @DatabaseField(generatedId = true)
    private int id;
    @DatabaseField(columnName = "uuid")
    private String uuid = UUID.randomUUID().toString();
    @DatabaseField(columnName = "familyId")
    private String familyId;

    @DatabaseField
    private String did;
    // 产品ID
    @DatabaseField
    private String pid;

    // 设备名称
    @DatabaseField
    private String name;
    // 设备名称
    @DatabaseField
    private int terminalId = 1;

    //父设备ID 父设备ID为空表示此设备为主设备
    @DatabaseField
    private String pdid;

    @DatabaseField
    private String mac;

    // 设备密钥
    @DatabaseField
    private long password;

    // 设备类型
    @DatabaseField
    private int deviceType;

    // 标记设备类型,0为扫到的设备，1为虚拟的设备
    @DatabaseField
    private int blType = 1;

    // 设备是否加锁
    @DatabaseField
    private boolean lock;

    // AES密钥
    @DatabaseField
    private String key;

    @DatabaseField
    private String extend;



    public String getDid() {
        return did;
    }

    public void setDid(String did) {
        this.did = did;
    }

    public String getMac() {
        return mac;
    }

    public void setMac(String mac) {
        this.mac = mac;
    }

    public long getPassword() {
        return password;
    }

    public void setPassword(long password) {
        this.password = password;
    }

    public int getDeviceType() {
        return deviceType;
    }

    public void setDeviceType(int deviceType) {
        this.deviceType = deviceType;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public boolean isLock() {
        return lock;
    }

    public void setLock(boolean lock) {
        this.lock = lock;
    }

    public String getKey() {
        return key;
    }

    public void setKey(String key) {
        this.key = key;
    }

    public int getTerminalId() {
        return terminalId;
    }

    public void setTerminalId(int terminalId) {
        this.terminalId = terminalId;
    }

    public String getExtend() {
        return extend;
    }

    public void setExtend(String extend) {
        this.extend = extend;
    }


    public String getPid() {
        return pid;
    }

    public void setPid(String pid) {
        this.pid = pid;
    }

    public String getPdid() {
        return pdid;
    }

    public void setPdid(String pdid) {
        this.pdid = pdid;
    }

    public int getId() {
        return id;
    }

    public void setId(int id) {
        this.id = id;
    }

    public String getUuid() {
        return uuid;
    }

    public void setUuid(String uuid) {
        this.uuid = uuid;
    }

    public String getFamilyId() {
        return familyId;
    }

    public void setFamilyId(String familyId) {
        this.familyId = familyId;
    }

    public int getBlType() {
        return blType;
    }

    public void setBlType(int blType) {
        this.blType = blType;
    }

    public BLDeviceInfo() {
        super();
    }

    public BLDeviceInfo(BLDNADevice probeDevInfo) {
        super();
        this.setDid(probeDevInfo.getDid());
        this.setPid(probeDevInfo.getPid());
        this.setMac(probeDevInfo.getMac());
        this.setName(probeDevInfo.getName());
        this.setDeviceType(probeDevInfo.getType());
        this.setTerminalId(probeDevInfo.getId());
        this.setKey(probeDevInfo.getKey());
        this.setLock(probeDevInfo.isLock());
        this.setPassword(probeDevInfo.getPassword());
        this.setPdid(probeDevInfo.getpDid());
        this.setExtend(probeDevInfo.getExtend());
    }

    public BLDNADevice cloneBLDNADevice(){
        BLDNADevice probeDevInfo = new BLDNADevice();
        probeDevInfo.setDid(getDid());
        probeDevInfo.setMac(getMac());
        probeDevInfo.setId(getTerminalId());
        probeDevInfo.setKey(getKey());
        probeDevInfo.setLock(isLock());
        probeDevInfo.setPid(getPid());
        probeDevInfo.setpDid(getPdid());
        probeDevInfo.setName(getName());
        probeDevInfo.setPassword(getPassword());
        probeDevInfo.setType(getDeviceType());
        probeDevInfo.setExtend(getExtend());
        return probeDevInfo;
    }

    @Override
    public String toString() {
        return "BLDeviceInfo{" +
                "id=" + id +
                ", uuid='" + uuid + '\'' +
                ", familyId='" + familyId + '\'' +
                ", did='" + did + '\'' +
                ", pid='" + pid + '\'' +
                ", name='" + name + '\'' +
                ", pdid='" + pdid + '\'' +
                ", mac='" + mac + '\'' +
                ", password=" + password +
                ", deviceType=" + deviceType +
                ", blType=" + blType +
                ", lock=" + lock +
                ", key='" + key + '\'' +
                ", terminalId=" + terminalId +
                ", extend='" + extend + '\'' +
                '}';
    }
}
